package com.huida.app.java8;

import lombok.extern.slf4j.Slf4j;

/**
 * @author wangzhuangzhuang
 * @DESC:
 * @date 2022-01-02 21:40
 */
@Slf4j
public class DemoTest01 {
	public static void main(String[] args) {
		Double rate01 = 2.544;
		Double rate02 = 2.545;
		Double rate03 = 2.546;
		log.info("rate01, {}", String.format("%.2f", rate01)); // rate01, 2.54
		log.info("rate02, {}", String.format("%.2f", rate02)); // rate02, 2.55
		log.info("rate03, {}", String.format("%.2f", rate03)); // rate02, 2.55 (会进行四舍五入)
	}
}